package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.OrderRepairDete;
import com.indusfo.spc.service.OrderRepairDeteService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author liub
 * @Date 2019/11/27 14:49
 * @Version 1.0
 */

@Controller
@RequestMapping("/service/orderRepairDete")
public class OrderRepairDeteController {

    @Autowired
    private OrderRepairDeteService orderRepairDeteService;

    /**
     * 查询
     */
    @RequestMapping(value = "/queryOrderRepairDete")
    @ResponseBody
    public JSONObject queryOrderRepairDete(OrderRepairDete orderRepairDete) {
        JSONObject json = orderRepairDeteService.queryOrderRepairDete(orderRepairDete);
        return json;
    }

    /**
     * 新增
     */
    @RequestMapping(value = "/insertOrderRepairDete", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject insertOrderRepairDete(OrderRepairDete orderRepairDete) {
        JSONObject json = orderRepairDeteService.insertOrderRepairDete(orderRepairDete);
        return json;
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/updateOrderRepairDete", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject updateOrderRepairDete(OrderRepairDete orderRepairDete) {
        JSONObject json = orderRepairDeteService.updateOrderRepairDete(orderRepairDete);
        return json;
    }

    /**
     * 删除
     */
    @RequestMapping(value = "/deleteOrderRepairDete", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject deleteOrderRepairDete(@RequestParam("orderRepairDeteIds") List<Integer> orderRepairDeteIds, Integer dataState) {
        dataState = 2;
        JSONObject json = orderRepairDeteService.deleteOrderRepairDete(orderRepairDeteIds, dataState);
        return json;
    }

    /**
     * 启停
     */
    @RequestMapping(value = "/definedOrderRepairDete", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject definedOrderRepairDete(@RequestParam("orderRepairDeteIds") List<Integer> orderRepairDeteIds, Integer dataState) {
        JSONObject json = orderRepairDeteService.deleteOrderRepairDete(orderRepairDeteIds, dataState);
        return json;
    }

}
